<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Vue样式绑定</title>
  <style>
    .green{
      color: green;
    }
    .orange{
      color: orange;
    }
  </style>
</head>
<body>
  <div id="root"></div>
  <script src="https://unpkg.com/vue@next"></script>  
  <script>
    const app = Vue.createApp({
      // 根组件
      data(){
        return{
          classString: 'green',
          classObject: {
            green: false,
            orange: true,
          },
          // classArray: ['green', 'orange']
          classArray: ['green', {orange: false}]
        }
      },
      // template: `<div :class="classString"><h1>Hello Vue</h1></div>`
      // template: `<div :class="classObject"><h1>Hello Vue</h1></div>`
      template: `<div :class="classArray">
                <h1>Hello Vue</h1>
                <test />
                </div>`
    });

    // 子组件
    app.component('test', {
      template: `<div class="orange"><h3>conponent 子组件<h3></div>`
    });
    const vm = app.mount('#root')
  </script>
</body>
</html>